/**
 * 编译打包构建项目
 */
import esbuild from "esbuild";
import BaseConfig from "./base.js";

(async () => {
  let context = await esbuild.context({
    ...BaseConfig,
    sourcemap: "both",
    metafile: true,
  });

  //   let text = await esbuild.analyzeMetafile(context.metafile, {
  //     verbose: true,
  //   });
  //   console.log(text);

  await context.watch();
  let { host, port } = await context.serve({
    servedir: "dist",
    port: 8880,
    host: "127.0.0.1",
  });
  console.log(`Serve is listening on http://${host}:${port}`);
})();
